package com.example.easydownloadback.exception;

import com.example.easydownloadback.domin.ResponseResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//定义其为异常控制器
@ControllerAdvice
public class ExceptionHandlerManage {

    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public ResponseResult handle(ServiceException se) {
        return new ResponseResult(se.getCode(), se.getMessage());
    }
}
